Repository navigation
PostgreSQL: Support optional FROM/IN and direction in FETCH - #3049
icecrasher321 wants to merge 1 commit into
Conversation
|
@LucaCappelletti94 let me know if this looks good to you |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3049 +/- ##
==========================================
+ Coverage 83.55% 83.58% +0.03%
==========================================
Files 42 42
Lines 35692 35714 +22
Branches 35692 35714 +22
==========================================
+ Hits 29822 29852 +30
+ Misses 2429 2426 -3
+ Partials 3441 3436 -5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
LucaCappelletti94
left a comment
There was a problem hiding this comment.
Please add the seed fuzzers, then run the differential fuzzer with pg_query to determine whether you are covering the full set of this new syntax you are adding.
Co-authored-by: Cursor <cursoragent@cursor.com>
4060c11 to
0afdfc9
Compare
|
@LucaCappelletti94 added, thanks |
| ] { | ||
| assert_eq!( | ||
| pg().parse_sql_statements(sql).unwrap_err().to_string(), | ||
| "sql parser error: Expected: identifier, found: EOF", |
There was a problem hiding this comment.
use the typed error
| pg().parse_sql_statements("FETCH ABSOLUTE c") | ||
| .unwrap_err() | ||
| .to_string(), | ||
| "sql parser error: Expected: a concrete value, found: c" |
There was a problem hiding this comment.
use the error type
| pg().parse_sql_statements("FETCH -$1 FROM c") | ||
| .unwrap_err() | ||
| .to_string(), | ||
| "sql parser error: Expected: literal number, found: $1" |
There was a problem hiding this comment.
use the typed error, maybe a for loop for these few repeated patterns
Dialects: PostgreSQL
Closes #3050
PostgreSQL's
FETCHaccepts an optional direction, optionalFROM/IN, and signed counts, which currently fail to parse:Makes
FROM/INoptional, defaults an omitted direction toNEXT, makes theFORWARD/BACKWARDcount optional, and parses signed counts (no AST changes). Tested all these forms of the query.